﻿@using System.Data;
@{
    ViewBag.Title = "模板文件管理";
}
@model System.Data.DataTable
<div class="pageheader">
    <div class="page-bar">
        <ul class="page-breadcrumb">
            <li><a href="javascript:;"><i class="iconfont icon-home1"></i> 首页</a> </li>
            <li><a href="javascript:;">界面管理</a> </li>
            <li><a href="../settings/templet_list">模板管理</a> </li>
            <li><a href="javascript:;">@ViewBag.SkinName</a> </li>
        </ul>
    </div>
</div>
<div class="layui-fluid">
    <div class="layui-card layui-tab">
        <div class="layui-card-body table-tool-mini">
            <div class="tablebody">
                <table border="0" cellpadding="0" cellspacing="0" style="width:100%;height:500px;">
                    <tbody>
                        <tr>
                            <td valign="top" style="width:280px">
                                <div class="folderTagline" id="folderTagline">
                                    <span class="folderroot">文件路径</span>
                                    <span class="folder"><a href="templet_file_list?skin=@ViewBag.SkinName&areas=@ViewBag.Areas" target="_self">@ViewBag.SkinName</a></span>
                                    <span class="raquo">/</span>
                                    @{
                                        string temp = string.Empty;
                                        string filepath = ViewBag.FilePath as string;
                                        foreach (string path in filepath.Split('/'))
                                        {
                                            if (path != "")
                                            {
                                                <span class="folder"><a href="templet_file_list?skin=@ViewBag.SkinName&filepath=@(temp + path)" target="_self">@path</a></span>
                                                <span class="raquo">/</span>
                                                temp += path + "/";
                                            }
                                        }
                                    }
                                </div>
                                <ul class="templatefilelist" id="templatefilelist">
                                    @foreach (DataRow item in Model.Rows)
                                    {
                                        <li class="@item["type"]">
                                            <span class="icon"></span>
                                            <div class="info">
                                                <div class="tline"><span class="name"><a href="@item["url"]" target="@item["target"]">@item["name"]</a></span></div>
                                                <div class="bline"><span class="size">@item["size"]</span><span class="time">@item["updatetime"]</span></div>
                                            </div>
                                        </li>
                                    }
                                </ul>
                            </td>
                            <td valign="top">
                                <div class="template_code_editor">
                                    <iframe src="../settings/blank" name="templateFrame" id="templateFrame" class="templateFrame" frameborder="no" scrolling="auto"></iframe>
                                </div>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
@section Scripts{
    <script type="text/javascript">
        layui.use(['form'], function () {
            var $ = layui.jquery;
            mainPageResize();
            $(window).resize(function () {
                //延迟执行,防止多次触发
                setTimeout(function () {
                    mainPageResize();
                }, 100);
            });
            //布局
            function mainPageResize() {
                var winHeight = $(window).height(), winWidth = $(window).width();
                $("#templatefilelist").height(winHeight - 100);
                $("#templateFrame").height(winHeight - 67).width(winWidth - 350);
            }
            layer.photos({
                photos: '#templatefilelist',
                shade: .1,
                closeBtn: true
            });

            //显示图片
            window.ballImages = function (src) {
                var img = '<img src="' + src + '">';
                layer.open({
                    type: 1,
                    shade: false,
                    title: false,
                    content: img
                });
            }
        });
    </script>
}